package com.codemonkey.lq.common.util;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;

public final class TraceHandler<T> implements InvocationHandler {

    private T target;

    public TraceHandler(T target) {
        super();
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("调用方法: " + method.getName());
        System.out.println("方法中使用的参数: " + Arrays.toString(args));
        return method.invoke(target, args);
    }

}
